package cn.tedu._05mvcboot01.controller;

import cn.tedu._05mvcboot01.pojo.dto.WeichatDTO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Controller
public class UserController {
    @RequestMapping(value = "/v1/users/login")
    @ResponseBody
    public String login(){
        return "恭喜你，登录成功";
    }

    @RequestMapping(value = "v1/users/reg")
    @ResponseBody
    public String reg(HttpServletRequest request){
        String username = request.getParameter("username");
        String password = request.getParameter("password");
        return username + "-" + password;
    }

    @RequestMapping(value = "/v1/users/changepwd")
    @ResponseBody
    public String changedpwd(String username,String newpwd){
        return username + "-" +newpwd;
    }

    @RequestMapping(value = "/v1/users/weiChat")
    @ResponseBody
    public String weiChat(WeichatDTO weichatDTO){
        String name = weichatDTO.getName();
        String pwd = weichatDTO.getPwd();
        return name+":"+pwd;

    }
}
